package com.itheima.thread;
/*
测试类
 */
public class Demo01 {
    public static void main(String[] args) {
        MyThread t1 = new MyThread();
        //开启一个线程
        t1.setName("小蔡");
        t1.start();
        MyThread t2 = new MyThread();
        //开启一个线程
        t2.setName("小黄");
        t2.start();
        for (int i = 0; i < 100; i++) {
            System.out.println("main线程执行到了"+i);
        }

    }

}
class MyThread extends Thread{
    public MyThread() {
        super();
    }

    //重写run方法  线程想要干什么就在run中写什么样的代码
    @Override
    public void run() {

        for (int i = 0; i < 100; i++) {
            System.out.println(getName()+"执行到了"+i);
        }
    }
}